<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>倒计时</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            min-height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
            background: linear-gradient(135deg, #1a2a6c, #b21f1f, #fdbb2d);
            color: white;
            overflow: hidden;
            position: relative;
        }
        
        .container {
            width: 90%;
            max-width: 900px;
            background: rgba(0, 0, 0, 0.7);
            backdrop-filter: blur(10px);
            border-radius: 20px;
            padding: 2.5rem;
            text-align: center;
            box-shadow: 0 15px 30px rgba(0, 0, 0, 0.4);
            z-index: 10;
            position: relative;
            overflow: hidden;
        }
        
        .container::before {
            content: '';
            position: absolute;
            top: -50%;
            left: -50%;
            width: 200%;
            height: 200%;
            background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
            z-index: -1;
        }
        
        h1 {
            font-size: 2.8rem;
            margin-bottom: 1rem;
            text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
            position: relative;
        }
        
        h1::after {
            content: '';
            display: block;
            width: 100px;
            height: 4px;
            background: linear-gradient(to right, #fdbb2d, #b21f1f);
            margin: 0.8rem auto;
            border-radius: 2px;
        }
        
        .config-panel {
            background: rgba(255, 255, 255, 0.15);
            padding: 1.5rem;
            border-radius: 15px;
            margin: 1.5rem 0;
            text-align: left;
        }
        
        .config-title {
            font-size: 1.4rem;
            margin-bottom: 1rem;
            color: #fdbb2d;
            display: flex;
            align-items: center;
            gap: 10px;
        }
        
        .config-controls {
            display: flex;
            flex-wrap: wrap;
            gap: 20px;
            justify-content: center;
        }
        
        .time-control {
            display: flex;
            flex-direction: column;
            min-width: 200px;
        }
        
        .time-control label {
            margin-bottom: 8px;
            font-size: 1.1rem;
            opacity: 0.9;
        }
        
        .time-control input {
            padding: 12px 15px;
            font-size: 1.2rem;
            border-radius: 10px;
            border: none;
            background: rgba(0, 0, 0, 0.4);
            color: white;
            text-align: center;
        }
        
        .date-info {
            font-size: 1.3rem;
            margin: 1.5rem 0;
            opacity: 0.9;
            font-weight: 300;
        }
        
        .countdown-container {
            display: flex;
            justify-content: center;
            gap: 1.5rem;
            margin: 2.5rem 0;
        }
        
        .time-box {
            display: flex;
            flex-direction: column;
            align-items: center;
        }
        
        .time-value {
            font-size: 4.5rem;
            font-weight: 700;
            min-width: 120px;
            padding: 1rem;
            background: rgba(255, 255, 255, 0.1);
            border-radius: 15px;
            box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
            margin-bottom: 0.5rem;
            position: relative;
            overflow: hidden;
        }
        
        .time-value::after {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 4px;
            background: linear-gradient(to right, #fdbb2d, #b21f1f);
        }
        
        .time-label {
            font-size: 1.2rem;
            text-transform: uppercase;
            letter-spacing: 2px;
            opacity: 0.8;
        }
        
        .status-message {
            font-size: 1.8rem;
            margin: 1.5rem 0;
            color: #fdbb2d;
            font-weight: 600;
            min-height: 2.5rem;
        }
        
        .progress-container {
            width: 100%;
            height: 12px;
            background: rgba(255, 255, 255, 0.1);
            border-radius: 10px;
            overflow: hidden;
            margin: 2rem 0;
        }
        
        .progress-bar {
            height: 100%;
            background: linear-gradient(to right, #fdbb2d, #b21f1f);
            border-radius: 10px;
            width: 0%;
            transition: width 0.5s ease;
        }
        
        .info-text {
            font-size: 1.1rem;
            margin-top: 1.5rem;
            opacity: 0.8;
            font-weight: 300;
            line-height: 1.6;
        }
        
        .target-icon {
            font-size: 2.5rem;
            margin: 0.5rem 0;
            color: #fdbb2d;
            text-shadow: 0 0 20px rgba(253, 187, 45, 0.7);
        }
        
        /* 背景动画元素 */
        .bg-bubbles {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            z-index: 1;
        }
        
        .bubble {
            position: absolute;
            border-radius: 50%;
            background: rgba(255, 255, 255, 0.1);
            bottom: -100px;
            animation: rise 15s infinite ease-in;
        }
        
        @keyframes rise {
            0% {
                bottom: -100px;
                transform: translateX(0);
            }
            50% {
                transform: translateX(100px);
            }
            100% {
                bottom: 1080px;
                transform: translateX(-200px);
            }
        }
        
        /* 响应式设计 */
        @media (max-width: 768px) {
            .container {
                padding: 1.5rem;
            }
            
            h1 {
                font-size: 2.2rem;
            }
            
            .time-value {
                font-size: 3rem;
                min-width: 90px;
            }
            
            .countdown-container {
                gap: 1rem;
            }
            
            .status-message {
                font-size: 1.5rem;
            }
            
            .config-controls {
                flex-direction: column;
                align-items: center;
            }
        }
        
        @media (max-width: 480px) {
            h1 {
                font-size: 1.8rem;
            }
            
            .time-value {
                font-size: 2.2rem;
                min-width: 70px;
                padding: 0.8rem;
            }
            
            .time-label {
                font-size: 0.9rem;
            }
            
            .date-info {
                font-size: 1rem;
            }
        }
    </style>
</head>
<body>
    <!-- 背景动画气泡 -->
    <div class="bg-bubbles" id="bubbles"></div>
    
    <div class="container">
        <div class="target-icon">
            <i class="fas fa-bullseye"></i>
        </div>
        <h1>恰饭倒计时</h1>
        
        <div class="config-panel">
            <div class="config-title">
                <i class="fas fa-cog"></i>
                <span>设置目标时间</span>
            </div>
            <div class="config-controls">
                <div class="time-control">
                    <label for="target-hour">小时 (0-23)</label>
                    <input type="number" id="target-hour" min="0" max="23" value="15">
                </div>
                <div class="time-control">
                    <label for="target-minute">分钟 (0-59)</label>
                    <input type="number" id="target-minute" min="0" max="59" value="30">
                </div>
            </div>
        </div>
        
        <div class="date-info" id="date-info">2023年6月15日 星期四</div>
        
        <div class="countdown-container">
            <div class="time-box">
                <div class="time-value" id="hours">00</div>
                <div class="time-label">小时</div>
            </div>
            <div class="time-box">
                <div class="time-value" id="minutes">00</div>
                <div class="time-label">分钟</div>
            </div>
            <div class="time-box">
                <div class="time-value" id="seconds">00</div>
                <div class="time-label">秒钟</div>
            </div>
        </div>
        
        <div class="status-message" id="status-message">设置目标时间后，倒计时将自动开始</div>
        
        <div class="progress-container">
            <div class="progress-bar" id="progress-bar"></div>
        </div>
        
        <div class="info-text">
            <p>当前时间: <span id="current-time">00:00:00</span> | 目标时间: <span id="target-time">15:30:00</span></p>
            <p>目标时间倒计时将每天自动重置</p>
        </div>
    </div>
    
    <script>
        // 创建背景气泡
        function createBubbles() {
            const bubblesContainer = document.getElementById('bubbles');
            const bubbleCount = 20;
            
            for (let i = 0; i < bubbleCount; i++) {
                const bubble = document.createElement('div');
                bubble.classList.add('bubble');
                
                // 随机大小
                const size = Math.random() * 100 + 20;
                bubble.style.width = `${size}px`;
                bubble.style.height = `${size}px`;
                
                // 随机位置
                bubble.style.left = `${Math.random() * 100}%`;
                
                // 随机动画延迟
                bubble.style.animationDelay = `${Math.random() * 15}s`;
                
                // 随机动画时长
                const duration = 10 + Math.random() * 20;
                bubble.style.animationDuration = `${duration}s`;
                
                // 随机透明度
                bubble.style.opacity = Math.random() * 0.3 + 0.1;
                
                bubblesContainer.appendChild(bubble);
            }
        }
        
        // 更新倒计时
        function updateCountdown() {
            const now = new Date();
            const currentHours = now.getHours();
            const currentMinutes = now.getMinutes();
            const currentSeconds = now.getSeconds();
            
            // 更新当前时间显示
            document.getElementById('current-time').textContent = 
                `${String(currentHours).padStart(2, '0')}:${String(currentMinutes).padStart(2, '0')}:${String(currentSeconds).padStart(2, '0')}`;
            
            // 获取用户设置的目标时间
            const targetHour = parseInt(document.getElementById('target-hour').value) || 15;
            const targetMinute = parseInt(document.getElementById('target-minute').value) || 30;
            
            // 更新显示的目标时间
            document.getElementById('target-time').textContent = 
                `${String(targetHour).padStart(2, '0')}:${String(targetMinute).padStart(2, '0')}:00`;
            
            // 计算下一个目标时间
            let nextTarget = new Date();
            if (currentHours < targetHour || 
               (currentHours === targetHour && currentMinutes < targetMinute) || 
               (currentHours === targetHour && currentMinutes === targetMinute && currentSeconds < 0)) {
                // 如果还没到目标时间，目标时间为今天的设定时间
                nextTarget.setHours(targetHour, targetMinute, 0, 0);
            } else {
                // 如果已经过了目标时间，目标时间为明天的设定时间
                nextTarget.setDate(nextTarget.getDate() + 1);
                nextTarget.setHours(targetHour, targetMinute, 0, 0);
            }
            
            // 计算时间差（毫秒）
            const diff = nextTarget - now;
            
            // 转换为小时、分钟、秒
            const totalSeconds = Math.floor(diff / 1000);
            const hours = Math.floor(totalSeconds / 3600);
            const minutes = Math.floor((totalSeconds % 3600) / 60);
            const seconds = totalSeconds % 60;
            
            // 更新显示
            document.getElementById('hours').textContent = String(hours).padStart(2, '0');
            document.getElementById('minutes').textContent = String(minutes).padStart(2, '0');
            document.getElementById('seconds').textContent = String(seconds).padStart(2, '0');
            
            // 更新状态信息
            const statusMessage = document.getElementById('status-message');
            if (hours === 0 && minutes === 0 && seconds < 30) {
                statusMessage.textContent = "目标时间即将到来！";
                statusMessage.style.color = "#fdbb2d";
            } else if (hours === 0 && minutes < 5) {
                statusMessage.textContent = `距离目标时间不到5分钟！`;
                statusMessage.style.color = "#fdbb2d";
            } else if (currentHours > targetHour || 
                      (currentHours === targetHour && currentMinutes > targetMinute) ||
                      (currentHours === targetHour && currentMinutes === targetMinute && currentSeconds > 0)) {
                statusMessage.textContent = "目标时间已过，倒计时至明天";
                statusMessage.style.color = "#b21f1f";
            } else {
                statusMessage.textContent = "倒计时进行中...";
                statusMessage.style.color = "#fdbb2d";
            }
            
            // 更新进度条
            const progressBar = document.getElementById('progress-bar');
            // 计算到目标时间的总秒数
            const totalTargetSeconds = targetHour * 3600 + targetMinute * 60;
            const elapsedSeconds = currentHours * 3600 + currentMinutes * 60 + currentSeconds;
            
            let progressPercentage;
            if (currentHours < targetHour || 
                (currentHours === targetHour && currentMinutes < targetMinute)) {
                progressPercentage = (elapsedSeconds / totalTargetSeconds) * 100;
            } else {
                // 目标时间已过
                progressPercentage = 100;
            }
            
            progressBar.style.width = `${progressPercentage}%`;
        }
        
        // 更新日期信息
        function updateDateInfo() {
            const now = new Date();
            const options = { 
                year: 'numeric', 
                month: 'long', 
                day: 'numeric', 
                weekday: 'long' 
            };
            const dateStr = now.toLocaleDateString('zh-CN', options);
            document.getElementById('date-info').textContent = dateStr;
        }
        
        // 初始化
        document.addEventListener('DOMContentLoaded', () => {
            createBubbles();
            updateDateInfo();
            updateCountdown();
            
            // 每秒更新一次倒计时
            setInterval(updateCountdown, 1000);
            
            // 为输入框添加事件监听器
            document.getElementById('target-hour').addEventListener('change', updateCountdown);
            document.getElementById('target-minute').addEventListener('change', updateCountdown);
        });
    </script>
</body>
</html>